<template>
    <div>
        <div>
            <div style="float: left;">
                <el-form :inline="true" :model="searchForm" class="demo-form-inline">
                    <el-form-item><el-input clearable v-model="searchForm.name" style="width: 300px" placeholder="方案名称"></el-input></el-form-item>
                    <el-form-item>
                        <el-select clearable v-model="searchForm.state" style="width: 300px" placeholder="审批状态">
                            <el-option label="未发布" value="0"></el-option>
                            <el-option label="申报中" value="1"></el-option>
                            <el-option label="待评分" value="2"></el-option>
                            <el-option label="已评分" value="3"></el-option>
                            <el-option label="已审批" value="4"></el-option>
                            <el-option label="已公示" value="5"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item><el-button type="primary" @click="query">搜索</el-button></el-form-item>
                </el-form>
            </div>
            <div style="float: left;">
                <el-button style="margin-bottom: 10px" type="success" @click="createPlan">创建方案</el-button>
            </div>
        </div>
        <el-table
                :data="tableData"
                border
                align="center"
                style="width: 100%">
            <el-table-column
                    prop="name"
                    label="项目名称"
                    align="center"
                    width="200">
            </el-table-column>
            <el-table-column
                    prop="year"
                    label="评估年度"
                    align="center"
                    width="200">
            </el-table-column>
            <el-table-column
                    prop="apply_endtime"
                    label="评估申请截止时间"
                    align="center"
                    width="200">
            </el-table-column>
            <el-table-column
                    prop="state"
                    label="状态"
                    align="center"
                    width="200">
                <template slot-scope="scope">
                    <span v-if="scope.row.state == '0'">未发布</span>
                    <span v-if="scope.row.state == '1'">申报中</span>
                    <span v-if="scope.row.state == '2'">待评分</span>
                    <span v-if="scope.row.state == '3'">已评分</span>
                    <span v-if="scope.row.state == '4'">已审批</span>
                    <span v-if="scope.row.state == '5'">已公示</span>
                </template>
            </el-table-column>
            <el-table-column label="操作" align="center">
                <template slot-scope="scope">
                    <el-button
                            v-show="scope.row.state==='0'"
                            size="mini"
                            type="success"
                            @click="updatestate(scope.$index,scope.row)">发布</el-button>
                    <el-button
                            v-show="scope.row.state==='0'"
                            size="mini"
                            type="primary"
                            @click="update( scope.row)">修改</el-button>
                    <el-button
                            v-show="scope.row.state!=='0'"
                            size="mini"
                            type="info"
                            @click="info(scope.row)">详情</el-button>
                    <el-button
                            v-show="scope.row.state==='0'"
                            size="mini"
                            type="danger"
                            @click="delect(scope.$index, scope.row)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
        <!-- 分页 -->
        <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="pageNo"
                :page-sizes="[10, 20, 50, 100]"
                :page-size="pageSize"
                layout="total, sizes, prev, pager, next"
                :total="totalRecord" class="text-center mt10">
        </el-pagination>
        <!-- 方案修改弹出框 -->
        <el-dialog title="方案修改显示" :visible.sync="dialogFormVisible">
            <el-tabs v-model="updateActiveName" @tab-click="handleClick">
                <el-tab-pane label="项目" name="first">
                    <el-form :model="upform">
                        <el-form-item label="项目名称" :label-width="formLabelWidth">
                            <el-input v-model="upform.name" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="参评社会组织性质" :label-width="formLabelWidth">
                            <el-input v-model="upform.nature " autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="评估年度" :label-width="formLabelWidth">
                            <el-input v-model="upform.year" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="评估申请截止时间" :label-width="formLabelWidth">
                            <el-date-picker type="date" placeholder="选择日期" v-model="apply_endtime" style="width: 100%;"></el-date-picker>
                        </el-form-item>
                        <el-form-item label="参评条件" :label-width="formLabelWidth">
                            <el-input v-model="upform.condition " autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="指标模版" :label-width="formLabelWidth">
                            <el-select v-model="upform.template_code" placeholder="">
                                <el-option
                                        v-for="item in notemplatelist1"
                                        :key="item.id"
                                        :label="item.name "
                                        :value="item.code ">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="组织账号" placeholder="" :label-width="formLabelWidth">
                            <el-select v-model="createZzid" >
                                <el-option
                                        v-for="item in zzlist1"
                                        :key="item.id"
                                        :label="item.company_name +'-'+ item.name"
                                        :value="item.id + ',' + item.name +',' + item.company_name">
                                </el-option>
                            </el-select>
                            <el-button style="margin-left: 10px" size="mini" type="primary" @click="createZzlist(createZzid)">添加</el-button>
                        </el-form-item>
                        <el-form-item label="组织账号" :label-width="formLabelWidth">
                            <el-tag
                                    :key="tag.id"
                                    v-for="tag in zzlist"
                                    closable
                                    :disable-transitions="false"
                                    @close="zzclosetag(tag.id)">
                                {{tag.name}}
                            </el-tag>
                        </el-form-item>
                    </el-form>
                    <div style="float: right;">
                        <el-button @click="dialogFormVisible = false">取 消</el-button>
                        <el-button type="primary" @click="updateover(upform)">确 定</el-button>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="专家账号" name="second">
                    <el-form :model="upform">
                        <el-form-item label="专家账号" :label-width="formLabelWidth">
                            <el-select v-model="form.zjid"  >
                                <el-option
                                        v-for="item in zjlist1"
                                        :key="item.id "
                                        :label="item.name"
                                        :value="item.id + ',' + item.name">
                                </el-option>
                            </el-select>
                            <el-button style="margin-left: 10px" size="mini" type="primary" @click="add(form.zjid)">添加</el-button>
                        </el-form-item>
                        <el-form-item label="专家账号" :label-width="formLabelWidth">
                            <el-tag
                                    :key="tag.id"
                                    v-for="tag in dynamicTags"
                                    closable
                                    :disable-transitions="false"
                                    @close="handleClose(tag)">
                                {{tag.approval_by_name}}
                            </el-tag>
                        </el-form-item>
                    </el-form>
                    <div style="float: right;">
                        <el-button type="primary" @click="dialogFormVisible = false">关 闭</el-button>
                    </div>
                </el-tab-pane>
            </el-tabs>
        </el-dialog>
        <!-- 方案创建弹出框 -->
        <el-dialog title="方案创建显示" :visible.sync="createFormVisible">
            <el-tabs type="border-card" v-model="activeName">
                <el-tab-pane label="项目" name="first">
                    <el-form :model="createForm" :rules="rules" ref="createForm">
                        <el-form-item label="项目名称" :label-width="formLabelWidth" prop="createName">
                            <el-input v-model="createForm.createName" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="参评社会组织性质" :label-width="formLabelWidth" prop="createNature">
                            <el-input v-model="createForm.createNature" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="评估年度" :label-width="formLabelWidth" prop="createYear">
                            <el-input v-model="createForm.createYear" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="评估申请截止时间" :label-width="formLabelWidth" >
                            <el-date-picker type="date" placeholder="选择日期" v-model="createApply_endtime" style="width: 100%;"></el-date-picker>
                        </el-form-item>
                        <el-form-item label="参评条件" :label-width="formLabelWidth" prop="createCondition">
                            <el-input v-model="createForm.createCondition" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="指标模版" :label-width="formLabelWidth" prop="createTemplate">
                            <el-select v-model="createForm.createTemplate">
                                <el-option
                                        v-for="item in notemplatelist1"
                                        :key="item.id"
                                        :label="item.name "
                                        :value="item.code ">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="组织账号" :label-width="formLabelWidth">
                            <el-select v-model="createZzid">
                                <el-option
                                        v-for="item in zzlist1"
                                        :key="item.id"
                                        :label="item.company_name +'-'+ item.name"
                                        :value="item.id + ',' + item.name +',' + item.company_name" >
                                </el-option>
                            </el-select>
                            <el-button style="margin-left: 10px" size="mini" type="primary" @click="createZzlist(createZzid)">添加</el-button>
                        </el-form-item>
                        <el-form-item label="组织账号" :label-width="formLabelWidth">
                            <el-tag
                                    :key="tag.id"
                                    v-for="tag in zzlist"
                                    closable
                                    :disable-transitions="false"
                                    @close="zzclosetag(tag.id)">
                                {{tag.name}}
                            </el-tag>
                        </el-form-item>
                    </el-form>
                    <div style="width: 160px; margin-left: 445px;margin-top: 50px">
                        <el-button @click="createFormVisible = false">取 消</el-button>
                        <el-button type="primary" @click="createOver">确 定</el-button>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="专家账号" name="second">
                    <el-form>
                        <el-form-item label="专家账号" :label-width="formLabelWidth">
                            <el-select v-model="createZjid"  >
                                <el-option
                                        v-for="item in zjlist1"
                                        :key="item.id "
                                        :label="item.name"
                                        :value="item.id + ',' + item.name">
                                </el-option>
                            </el-select>
                            <el-button style="margin-left: 10px" size="mini" type="primary" @click="createZj(createZjid)">添加</el-button>
                        </el-form-item>
                        <el-form-item label="专家账号" :label-width="formLabelWidth">
                            <el-tag
                                    :key="tag.id"
                                    v-for="tag in dynamicTags"
                                    closable
                                    :disable-transitions="false"
                                    @close="closetag(tag)">
                                {{tag.approval_by_name}}
                            </el-tag>
                        </el-form-item>
                    </el-form>
                    <div style="width: 160px; margin-left: 520px">
                        <el-button type="primary" @click="closeCreateVisible">关 闭</el-button>
                    </div>
                </el-tab-pane>
            </el-tabs>
        </el-dialog>
        <!-- 详情显示弹出框 -->
        <el-dialog title="详情显示" :visible.sync="dialogFormVisible1">

            <el-tabs v-model="activeDetail" @tab-click="handleClick">
                <el-tab-pane label="方案信息" name="first">
                    <el-form :model="form1">
                        <el-form-item label="项目名称" :label-width="formLabelWidth">
                            <el-input v-model="form1.name" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="参评社会组织性质" :label-width="formLabelWidth">
                            <el-input v-model="form1.nature " autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="评估年度" :label-width="formLabelWidth">
                            <el-input v-model="form1.year" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="评估申请截止时间" :label-width="formLabelWidth">
                            <el-input v-model="form1.apply_endtime" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="参评条件" :label-width="formLabelWidth">
                            <el-input v-model="form1.condition " autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="组织账号" :label-width="formLabelWidth">
                            <el-tag
                                    :key="tag.id"
                                    v-for="tag in zzlistName"
                                    :disable-transitions="false">
                                {{tag}}
                            </el-tag>
                        </el-form-item>
                        <el-form-item label="专家账号" :label-width="formLabelWidth">
                            <el-tag
                                    :key="tag.id"
                                    v-for="tag in zjNameTags"
                                    :disable-transitions="false">
                                {{tag.approval_by_name}}
                            </el-tag>
                        </el-form-item>
                    </el-form>
                </el-tab-pane>
                <el-tab-pane label="申报信息" name="second">
                    <el-table  :data="declarationTableData" border>
                        <el-table-column prop="content" align="center" label="评估内容"></el-table-column>
                        <el-table-column prop="create_time" align="center" label="申报时间"></el-table-column>
                        <el-table-column prop="company_name" align="center" label="申报组织"></el-table-column>
                    </el-table>
                </el-tab-pane>
                <el-tab-pane label="评分信息" name="third">
                    <el-table  :data="approvalListTableData" border>
                        <el-table-column  align="center" label="评分">
                            <template slot-scope="scope">
                                {{scope.row.level}} - {{scope.row.fraction}}
                            </template>
                        </el-table-column>
                        <el-table-column prop="approval_time" align="center" label="评分时间"></el-table-column>
                        <el-table-column prop="approval_by_name" align="center" label="评分专家"></el-table-column>
                        <el-table-column prop="approval_by_name" align="center" label="评分状态">
                            <template slot-scope="scope">
                                <span v-if="scope.row.state == '0'">未评分</span>
                                <span v-if="scope.row.state == '1'">已评分</span>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-tab-pane>
                <el-tab-pane label="评估记录" name="four">
                    <el-table  :data="assessmentTableData" border>
                        <el-table-column prop="state" align="center" label="评估状态">
                            <template slot-scope="scope">
                                <span v-if="scope.row.state == '0'">退回</span>
                                <span v-else>已通过</span>
                            </template>
                        </el-table-column>
                        <el-table-column prop="reason" align="center" label="退回原因"></el-table-column>
                        <el-table-column prop="create_time" align="center" label="操作时间"></el-table-column>
                    </el-table>
                </el-tab-pane>
            </el-tabs>

            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialogFormVisible1=false">关 闭</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
    export default {
        data () {
            return {
                approvalListTableData:[],//评分记录数据
                assessmentTableData:[],//评估记录数据表
                declarationTableData:[],//申报信息数据表
                activeDetail:'first',//详情tab页绑定
                updateActiveName:'first',//修改tab页绑定
                tableData:[],//项目列表
                dialogFormVisible:false,//方案修改弹出框
                dialogFormVisible1:false,//详情显示弹出框
                createFormVisible:false,//方案创建弹出框
                upform:{},//修改页展示的数据
                form1:{},//详情页展示的数据
                form:{},//分页
                zzlist:{},//添加的组织列表
                dynamicTags:[],//配置专家账号列表
                notemplatelist1:[],//指标模版下啦列表
                zjlist1:[],//专家账号下啦列表
                zzlist1:[],//组织账号下啦列表
                formLabelWidth: '150px',
                activeName: 'first',//tabs页name

                c:'',
                b:'',

                createForm:{
                    createName:'',
                    createNature:'',
                    createYear:'',
                    /*createApply_endtime:'',*/
                    createCondition:'',
                    createTemplate:''
                },
                rules:{
                    createName:[{ required: true, message: '请输入项目名称', trigger: 'blur' }],
                    createNature: [{ required: true, message: '请输入组织性质', trigger: 'blur' }],
                    createYear: [{ required: true, message: '请输入评估年度', trigger: 'blur' }],
                    /*createApply_endtime: [{ required: true, message: '请输入评估申请截止时间', trigger: 'blur' }],*/
                    createCondition: [{ required: true, message: '请输入参评条件', trigger: 'blur' }],
                    createTemplate: [{ required: true, message: '请选择指标模版', trigger: 'blur' }],
                },
                searchForm:{
                    name:'',
                    state:''
                },

                /*createName:'',
                createNature:'',
                createYear:'',
                createApply_endtime:'',
                createCondition:'',
                createTemplate:'',*/
                createApply_endtime:'',
                createZzid:{},
                createZjid:'',
                list:[],//专家
                param:[],
                programme_id:'',
                upId:'',
                zzlistid:[],
                m:[],
                n:[],

                pageNo: 1,
                pageSize: 10,
                totalRecord: 0,
                totalPage: 0,

                zid:[],
                apply_endtime:'',//修改的时间
                detailId:'',//点击详情的id
                zzlistName:[],//详情的组织列表
                zjNameTags:[],//详情的专家列表
            }
        },
        methods : {
            async handleClick(tab, event) {
                console.log(tab, event);
            },
            //分页
            async handleSizeChange(val) {
                this.pageSize = val;
                this.init();
            },
            async handleCurrentChange(val) {
                this.pageNo = val;
                this.init();
            },
            async closetag(param){//删除配置专家账号列表
                let res = await this.$http('deletescheme', {
                    id:param.id
                });
                this.dynamicTags = await this.$http('specialistlist', {
                    programme_id :this.programme_id
                });
            },
            async handleClose(param){//删除修改配置专家账号列表
                let res = await this.$http('deletescheme', {
                    id:param.id
                });
                this.dynamicTags = await this.$http('specialistlist', {
                    programme_id :this.upId
                });

            },
            async add(content){
                this.param = content.split(',');

                let updataId = this.param[0];
                let updataName = this.param[1];

                let zjRes = await this.$http('specialistcreate', {//添加专家
                    programme_id :this.upId,
                    zjid :updataId,
                    zjname :updataName,
                });
                this.dynamicTags = await this.$http('specialistlist', {//配置专家账号列表
                    programme_id :this.upId
                });
            },
            async delect(index,param){
                this.$confirm('将永久删除该项目, 是否继续?', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(async () => {
                    let res = await this.$http('createscheme', {
                        id : param.id,
                        del_flag : '1',
                    });
                    this.init();
                    this.$message({
                        type: 'success',
                        message: '删除成功!'
                    });
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            async info(param){//点击详情
                console.log('点击详情',param)
                this.activeDetail = 'first'
                if(param.state !=='0'){
                    this.dialogFormVisible1 = true
                    this.form1 = param
                    this.zzlistName = []
                    this.zid = param.zzid
                    let aaa = await this.$http('zzlist', {});
                    for (let i = 0; i < aaa.length; i++) {
                        this.m = aaa[i].id
                        for (let j = 0; j < this.zid.length; j++) {
                            this.n = this.zid[j]
                            if (this.m === this.n) {
                                this.zzlistName.push(aaa[i].company_name+'-'+aaa[i].name)
                            }
                        }
                    }
                    this.detailId = param.id
                    this.zjNameTags = await this.$http('specialistlist', {//配置专家账号列表
                        programme_id :this.detailId
                    });

                    this.declarationTableData = await this.$http('assessmentdeclareList',{
                        programme_id:param.id
                    });
                    console.log('shenbao',this.declarationTableData)
                    this.assessmentTableData = await this.$http('assessmentbackhistoryList',{
                        programme_id:param.id
                    })
                    console.log('评估记录',this.assessmentTableData)

                    this.approvalListTableData = await this.$http('approvalList',{
                        programme_id:param.id
                    })
                    console.log('评分记录',this.approvalListTableData)
                }
            },
            async updatestate(index,param){
                let res = await this.$http('updatestate', {
                    id:param.id,
                    state:'1'
                })
                console.log(res)
                if (res.count === 1) {
                    this.$message({
                        message: '发布成功',
                        type: 'success'
                    });
                }else{
                    this.$message({
                        message: '发布失败',
                        type: 'error'
                    });
                }
                this.init()
            },
            async updateover(param){//修改确认
                if(param.zzid === undefined || param.zzid.length===0){
                    param.zzid1 = ''
                }else{
                    param.zzid1 = param.zzid.join(',')
                }
                var timestamp = this.apply_endtime;
                var d = new Date(timestamp);    //根据时间戳生成的时间对象
                var date = (d.getFullYear()) + "-" +
                    (d.getMonth() + 1) + "-" +
                    (d.getDate())
                this.apply_endtime = date
                let res4 = await this.$http('createscheme', {
                    id:param.id,
                    name:param.name,
                    nature:param.nature,
                    year:param.year,
                    apply_endtime:this.apply_endtime,
                    condition:param.condition,
                    template_code:param.template_code,
                    zzid:this.zzlistid.join(','),
                    zjid:param.zjid1
                });
                // this.$message({
                //     message: '修改成功',
                //     type: 'success'
                // });
                /*this.dialogFormVisible = false
                this.init()*/
                if (res4.count === 1) {
                    this.$message({
                        message: '修改成功',
                        type: 'success'
                    });
                    this.dialogFormVisible = false
                    this.init()
                }else{
                    this.$message({
                        message: '修改失败',
                        type: 'error'
                    });
                    this.dialogFormVisible = false
                    this.init()
                }
            },
            async update(param){//点击修改
                this.apply_endtime = param.apply_endtime
                this.zzlistid = []
                this.zzlist = []

                this.zid = param.zzid

                /*if(param.zzid === undefined || param.zzid.length===0){
                    this.zid = ''
                }else{
                    this.zid = param.zzid.join(',')
                }*/

                console.log('zid',this.zid)
                let aaa = await this.$http('zzlist', {});
                console.log('aaa',aaa)
                for (let i = 0; i < aaa.length; i++) {
                    this.m = aaa[i].id
                    for (let j = 0; j < this.zid.length; j++) {
                        this.n = this.zid[j]
                        if (this.m === this.n) {
                            this.c = aaa[i].company_name+'-'+aaa[i].name
                            this.b = aaa[i].id
                            this.zzlist.push({
                                name:this.c,
                                id:this.b
                            })
                            // this.zzlist.push(aaa[i].company_name+'-'+aaa[i].name)
                            this.zzlistid.push(aaa[i].id)
                        }
                    }
                }
                console.log('id',this.zzlistid)
                console.log('zzlist',this.zzlist)
                this.dialogFormVisible = true
                this.upform = param
                this.upId = param.id;
                this.dynamicTags = await this.$http('specialistlist', {//配置专家账号列表
                    programme_id :this.upId
                });
            },
            /*删除组织账号*/
            async zzclosetag(id){
                console.log('id',id)
                let zzlist = this.zzlist
                for (var i = 0; i < zzlist.length; i++) {
                    if (id == zzlist[i].id) {
                        console.log('i',i)
                        this.zzlist.splice(i, 1);
                        this.zzlistid.splice(i, 1)
                    }
                }
            },
            /*配置组织账号*/
            async createZzlist(param){
                console.log('穿',param)
                let a = param.split(',')
                console.log('a',a)
                let b = a[0]//id
                console.log('b',b)
                let c = a[2]+'-'+a[1]//name
                console.log('c',c)
                this.zzlistid.push(b)

                console.log('this.zzlistid',this.zzlistid)
                /*this.zzlist.push(c)*/
                this.zzlist.push({
                    name:c,
                    id:b
                })

                console.log('this.zzlist',this.zzlist)
            },

            async createPlan(){
                this.zzlistid = []
                this.zzlist = []
                this.activeName='first'
                this.createZzid = ''
                this.dynamicTags = ''
                this.createFormVisible = true
            },
            async createOver(){//创建项目
                var timestamp = this.createApply_endtime;
                console.log('time',timestamp)
                var d = new Date(timestamp);    //根据时间戳生成的时间对象
                var date = (d.getFullYear()) + "-" +
                    (d.getMonth() + 1) + "-" +
                    (d.getDate())
                this.createApply_endtime = date
                console.log('xxxxxx',this.createApply_endtime)

                let createRes = await this.$http('createscheme', {
                    name:this.createForm.createName,
                    nature:this.createForm.createNature,
                    year:this.createForm.createYear,
                    apply_endtime:this.createApply_endtime,
                    condition:this.createForm.createCondition,
                    template_code:this.createForm.createTemplate,
                    zzid:this.zzlistid.join(','),
                });
                this.programme_id = createRes.uuid
                this.activeName = "second"
                if (createRes.count === 1) {
                    this.$message({
                        message: '创建成功',
                        type: 'success'
                    });
                    this.init()
                }else{
                    this.$message({
                        message: '创建失败',
                        type: 'error'
                    });
                    this.init()
                }
            },
            async createZj(zj){//添加专家账号接口
                this.list = zj.split(',');
                let dataid = this.list[0];
                let dataname = this.list[1];
                let zjRes = await this.$http('specialistcreate', {
                    programme_id :this.programme_id ,
                    zjid :dataid,
                    zjname :dataname,
                });
                this.dynamicTags = await this.$http('specialistlist', {//配置专家账号列表
                    programme_id :this.programme_id
                });
            },
            async closeCreateVisible(){
                this.createFormVisible = false
                this.init();
            },

            async query(){
                let res = await this.$http('schemeList', {
                    name : this.searchForm.name,
                    state :this.searchForm.state
                });
                for(var i = 0; i < res.results.length; i ++){
                    if(res.results[i].zzid !== undefined){
                        res.results[i].zzid = res.results[i].zzid.split(',')
                    }
                    if(res.results[i].zjid !== undefined ){
                        res.results[i].zjid = res.results[i].zjid.split(',')
                    }
                }
                this.tableData = res.results
                this.totalPage = res.totalPage;
                this.totalRecord = res.totalRecord;
            },


            async init () {
                let res = await this.$http('schemeList',{
                    pageNo: this.pageNo,
                    pageSize: this.pageSize,
                });
                for(var i = 0; i < res.results.length; i ++){
                    if(res.results[i].zzid !== undefined){
                        res.results[i].zzid = res.results[i].zzid.split(',')
                    }
                    if(res.results[i].zjid !== undefined ){
                        res.results[i].zjid = res.results[i].zjid.split(',')
                    }
                }
                this.tableData = res.results
                this.totalPage = res.totalPage;
                this.totalRecord = res.totalRecord;
                this.notemplatelist1 = await this.$http('notemplatelist', {});//指标模版下啦列表接口

                let res1 = await this.$http('zjlist', {});//专家账号下啦列表接口
                this.zjlist1 = res1

                let res2 = await this.$http('zzlist', {});//组织账号下啦列表接口
                this.zzlist1 = res2

            },
        },
        mounted () {
            this.init();
        },
    }
</script>
